// pages/bianji/bianji.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    news:{
      title:'',
      pic:[],
      content:'',
      tag:[]
    }
  },

  

  /**
   * 组件的方法列表
   */
  methods: {
    setTitle(e){
      console.log(e)
      this.setData({
        ['news.title']:e.detail.value
      })
    },
    chooseImage(){
      let that = this
      wx.chooseImage({
        count: 1,
        sizeType:['compressed','original'],
        sourceType:['album','camera'],
        success:res=>{
          console.log(res)
          if(that.data.news.pic.length<1){
            that.setData({
              ['news.pic']:res.tempFilePaths
            })
          }
        }
      })
    },
    newsTag(e){
      console.log(e.detail.value)
      this.setData({
        ['news.tag']:e.detail.value.split('，')
      })
    }
  }
})
